{include file="layout/header" title="提现记录" /}
	<div class="view-body">
    {include file="layout/menu" /}
		<div class="view-product">
			<div class="company_identify">
				<div class="manage-head">
					<h6 class="padding-left manage-head-con">提现记录</h6>
				</div>

				<form class="layui-form" action="{:url('admin/User/withdraw')}" method="post" name="form">
					<div class="layui-form-item">
					    <label class="layui-form-label">用户名</label>
						<div class="layui-input-inline">
					      	<input type="text" name="username" class="layui-input">
					    </div>
						<div class="layui-input-inline">
					      	<button class="layui-btn layui-btn-primary">筛选</button>
					    </div>
					</div>
				</form>
				
				<div class="offcial-table tr-border table-margin clearfix">
					<div class="tr-th clearfix">
						<div class="th w10">用户名</div>
            			<div class="th w10">支付方式</div>
            			<div class="th w10">申请金额</div>
						<div class="th w10">手续费</div>
						<div class="th w10">返购物币</div>
						<div class="th w10">应付金额</div>
						<div class="th w10">状态</div>
						<div class="th w10">时间</div>
						<div class="th w10">备注</div>
						<div class="th w10">操作</div>
					</div>
						{volist name="list" id="v"}
						<div class="tr clearfix border-bottom-none">
							<div class="td w10">{$v.username}</div>
							<div class="td w10">{$v.type}</div>
							<div class="td w10">{$v.money}</div>
							<div class="td w10">{$v.fee}</div>
							<div class="td w10">{$v.shopping}</div>
							<div class="td w10">{$v.paid}</div>
							<div class="td w10">
								{eq name="v.status" value="0"}待审核{/eq}
				            	{eq name="v.status" value="1"}支付成功{/eq}
				            	{eq name="v.status" value="2"}支付失败{/eq}
							</div>
							<div class="td w10">{:date('Y-m-d',$v['create_time'])}</div>
							<div class="td w10">{$v.note}</div>
							<div class="td w10">
								{if $v['status'] == 0}
								<button data-wid="{$v.id}" class="layui-btn layui-btn-mini layui-btn-normal confirm-success">成功</button>
								<button data-wid="{$v.id}" class="layui-btn layui-btn-mini layui-btn-danger confirm-fail">失败</button>
								{/if}
							</div>
						</div>
						{/volist}
				</div>

				<div class="fl margin-top padding-big-left">
					
				</div>

				<div class="fr padding-big-right">
					<div class="page">
						{$list->render()}
					</div>
				</div>

			</div>
		</div>
	</div>
	<script type="text/javascript">
		new Form('form').init({$post});
	    layui.use(['form', 'layer'], function(){
			var $ = layui.jquery;
    		var layer = layui.layer;

    		$(".confirm-success").click(function() {
    			var wid = $(this).data('wid');
    			layer.confirm('确认已支付提现', {
		            btn: ['确认', '取消'],
		            icon: 3
		        }, function(index) {
		        	$.post('{:url("admin/User/confirmPay")}', {id: wid,status:'1'}, function(res) {
		            	if(res.status == 1){
		            		layer.msg(res.msg, {
			                    time: 1000
			                }, function() {
			                    location.reload();
			                });
		            	}else{
		            		layer.msg(res.msg);
		            	}
		            },'json');
		            layer.close(index);
		        });
		        return false;
		    });

		    $(".confirm-fail").click(function() {
    			var wid = $(this).data('wid');
    			layer.prompt({
				  	title: '请输入失败原因',
				}, function(value, index, elem){
				  	$.post('{:url("admin/User/confirmPay")}', {id: wid,status:'2',note:value}, function(res) {
		            	if(res.status == 1){
		            		layer.msg(res.msg, {
			                    time: 1000
			                }, function() {
			                    location.reload();
			                });
		            	}else{
		            		layer.msg(res.msg);
		            	}
		            },'json');
		            layer.close(index);
				});
		        return false;
		    });

		});
	</script>
{include file="layout/footer" /}
